<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
	<f:facet name="first">
		<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
	</f:facet>
	<title>Création de contrat</title>
</h:head>
<body>
	<h:form>
		<p:growl id="growlContrat" showDetail="true"></p:growl>
		<p:wizard flowListener="#{ContratController.onFlowProcess}"
			nextLabel="Suivant" backLabel="Précédent">
			<p:tab id="enfant" title="Enfant">
				<p:panel header="Détails de l'enfant">
					<h:messages errorClass="error" />
					<h:panelGrid columns="2" columnClasses="label, value"
						styleClass="grid">
						<h:outputText value="Nom: *" />
						<p:inputText required="true" label="nom"
							value="#{ContratController.enfant.nom}" />

						<h:outputText value="Prénom: *" />
						<p:inputText required="true" label="prenom"
							value="#{ContratController.enfant.prenom}" />

						<h:outputText value="Date de naissance: *" />
						<p:calendar required="true" locale="fr" showButtonPanel="true"
							navigator="true" label="Date de naissance"
							maxdate="#{ContratController.maxDate}"
							value="#{ContratController.enfant.dateNaissance}" />

					</h:panelGrid>
				</p:panel>
			</p:tab>
			<p:tab id="parent1" title="Sélection Parent(s)">
				<p:panel>
					<h:messages errorClass="error" />
					<h:form id="formParents">
						<p:pickList id="pickList" value="#{ContratController.parents}" var="p"   
                itemLabel="#{p.nom} - #{p.prenom}" itemValue="#{p.id}" /> 
						
						<p:commandButton value="Confirmer" update="formParents"/>
					</h:form>
				</p:panel>
			</p:tab>
			
			<p:tab id="infos" title="Informations">
				<p:panel header="Détails du contrat">
					<h:messages errorClass="error" />

					<h:panelGrid columns="2" columnClasses="label, value"
						styleClass="grid">

						<h:outputText value="Type de contrat: *" />
						<p:selectOneListbox style="width:100%" label="type"
							value="#{ContratController.typeContrat}">
							<f:selectItem itemLabel="Contrat Bébé" itemValue="1" />
							<f:selectItem itemLabel="Contrat Périscolaire" itemValue="2" />
						</p:selectOneListbox>
						<h:outputText value="Tarif horaire: *" />
						<p:inputText required="true" label="tarif"
							value="#{ContratController.tarif}" />
					</h:panelGrid>
					<p:commandButton value="Sauvegarder" update="growlContrat"
						actionListener="#{ContratController.save}" />
				</p:panel>
			</p:tab>
		</p:wizard>
	</h:form>
</body>
</html>